﻿namespace mVids
{
    using MediaPortal.Configuration;
    using MediaPortal.GUI.Library;
    using MediaPortal.Profile;
    //using MediaPortal.ServiceImplementations;
    using mVids.Properties;
    using SQLite.NET;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Drawing;
    using System.IO;
    using System.Text;
    using System.Threading;
    using System.Windows.Forms;

    public class config : Form
    {
        private ManualResetEvent[] addItems = new ManualResetEvent[5];
        private TextBox artistInfoBox;
        private BackgroundWorker bgw = new BackgroundWorker();
        private Button button1;
        private Button button10;
        private Button button11;
        private Button button12;
        private Button button13;
        private Button button2;
        private Button button3;
        private Button button4;
        private Button button5;
        private Button button6;
        private Button button7;
        private Button button8;
        private Button button9;
        private CheckBox checkBox1;
        private CheckBox checkBox2;
        private CheckBox checkBox3;
        private CheckBox checkBox5;
        private CheckBox checkBox6;
        private mVids.multipleThreadedChoice choiceDialog = new mVids.multipleThreadedChoice();
        private LinkLabel clearDBlink;
        private ColumnHeader columnHeader1;
        private ColumnHeader columnHeader2;
        private ComboBox comboBox1;
        private IContainer components = null;
        private mVids.database db = new mVids.database();
        private TextBox fanartInfobox;
        private FolderBrowserDialog folderBrowserDialog1;
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label13;
        private Label label14;
        private Label label15;
        private Label label16;
        private Label label17;
        private Label label18;
        private Label label19;
        private Label label2;
        private Label label20;
        private Label label21;
        private Label label22;
        private Label label23;
        private Label label24;
        private Label label25;
        private Label label26;
        private Label label27;
        private Label label28;
        private Label label29;
        private Label label3;
        private Label label30;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label9;
        private TextBox langBox;
        private LinkLabel linkLabel1;
        private ListBox listBox2;
        private ListBox listBox3;
        private ListView listView1;
        private TextBox maskBox;
        private OpenFileDialog openFileDialog1;
        private mVids.viewParseResults parseResults = new mVids.viewParseResults();
        private PictureBox pictureBox1;
        private PictureBox pictureBox2;
        private PictureBox pictureBox3;
        private PictureBox pictureBox4;
        private LinkLabel refreshMIlink;
        private LinkLabel refreshThumblink;
        private ListBox scanningListbox;
        private SplitContainer splitContainer1;
        private SplitContainer splitContainer2;
        private TabControl tabControl1;
        private TabPage tabPage1;
        private TabPage tabPage2;
        private TabPage tabPage3;
        private TextBox textBox1;
        private TextBox textBox11;
        private TextBox textBox12;
        private TextBox textBox13;
        private TextBox textBox14;
        private TextBox textBox15;
        private TextBox textBox16;
        private TextBox textBox2;
        private TextBox textBox3;
        private TextBox textBox4;
        private TextBox textBox5;
        private TextBox textBox6;
        private TextBox textBox7;
        private TextBox textBox8;
        private TextBox thumbHeight;
        private TextBox thumbInfoBox;
        private CheckBox top100KeyFanart;
        private CheckBox topLevelFanart;
        private CheckBox viewDlgChk;

        public config()
        {
            this.InitializeComponent();
            this.parseResults.pathBox.SelectedIndexChanged += new EventHandler(this.refreshParse);
        }

        public void addFilesDispatcher(List<mVids.musicVideo> videos)
        {
            this.addItems[0] = new ManualResetEvent(false);
            this.addItems[1] = new ManualResetEvent(true);
            this.addItems[2] = new ManualResetEvent(true);
            this.addItems[3] = new ManualResetEvent(true);
            this.addItems[4] = new ManualResetEvent(true);
            List<mVids.musicVideo> list = videos;
            int index = 0;
            this.db.backgroundImageItems = new ManualResetEvent[list.Count];
            object[] objArray = new object[] { this.db.backgroundImageItems.Length.ToString() };
            Log.Debug("Music Video DB - Image thread job array length set to {0}", objArray);
            foreach (mVids.musicVideo video in list)
            {
                try
                {
                    Log.Debug("Music Video DB - Found free thread at " + index.ToString() + " for " + video.Path, new object[0]);
                    this.bgw.ReportProgress(1, "Queued " + video.Path + " on thread " + index.ToString());
                    video.threadNumber = index;
                    video.jobNum = list.IndexOf(video);
                    this.addItems[index] = new ManualResetEvent(false);
                    ThreadPool.QueueUserWorkItem(new WaitCallback(this.sendToAdder), video);
                    index = WaitHandle.WaitAny(this.addItems);
                    if (!(GUIWindowManager.Initalized || !this.bgw.CancellationPending))
                    {
                        this.bgw.ReportProgress(1, "Waiting for all threads to exit before cancelling");
                        WaitHandle.WaitAll(this.addItems);
                        this.db.WaitAll();
                        return;
                    }
                }
                catch (Exception exception)
                {
                    Log.Error("Music Video DB - Config threading error={0}", new object[] { exception.ToString() });
                }
            }
            if (this.db.backgroundImageItems.Length < 10)
            {
                Log.Debug("Music Video DB - Sleeping for 5 seconds", new object[0]);
                Thread.Sleep(0x1388);
            }
            this.bgw.ReportProgress(1, "Waiting for all threads to finish");
            WaitHandle.WaitAll(this.addItems);
            this.db.WaitAll();
        }

        private void bgw_DoUpgrade(object sender, DoWorkEventArgs e)
        {
            List<mVids.musicVideo> videos = this.getVideosForUpgrade();
            this.addFilesDispatcher(videos);
        }

        private void bgw_DoWork(object sender, DoWorkEventArgs e)
        {
            if (!GUIWindowManager.Initalized)
            {
                this.bgw.ReportProgress(1, "Checking for and removing references to missing files");
            }
            string str = this.db.delMissing().ToString();
            Log.Info("Music Video DB - Found " + str + " missing files.", new object[0]);
            if (!GUIWindowManager.Initalized)
            {
                this.bgw.ReportProgress(1, "Removed " + str + " missing files");
            }
            this.textBox4.AppendText(DateTime.Now.ToLongTimeString() + ": Scan Started" + Environment.NewLine);
            this.updateDB();
        }

        private void bgw_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            if (e.ProgressPercentage == 50)
            {
                mVids.imgthreadJob userState = (mVids.imgthreadJob) e.UserState;
                Log.Debug("Music Video DB - Detected multiple artists", new object[0]);
                this.setupChoices(userState.choices, userState.musicVideo, userState.artist);
            }
            else
            {
                this.textBox4.AppendText(DateTime.Now.ToLongTimeString() + ": " + e.UserState.ToString() + Environment.NewLine);
            }
        }

        private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e != null)
            {
                MessageBox.Show("Done updating database!", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                this.button4.Text = "Refresh Database";
                this.button4.Enabled = true;
                this.clearDBlink.Enabled = true;
                this.refreshMIlink.Enabled = true;
                this.refreshThumblink.Enabled = true;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.openFileDialog1.ShowDialog();
            this.textBox1.Text = this.openFileDialog1.FileName;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.folderBrowserDialog1.ShowDialog();
            string selectedPath = this.folderBrowserDialog1.SelectedPath;
            if (!selectedPath.EndsWith(@"\"))
            {
                selectedPath = selectedPath + @"\";
            }
            this.textBox2.Text = selectedPath;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (this.listView1.Items.Count > 0)
            {
                foreach (string str in this.listView1.Items)
                {
                    if (Directory.Exists(str))
                    {
                        this.loadItems(str);
                    }
                }
            }
        }

        private void button3_Click_1(object sender, EventArgs e)
        {
            if (!this.bgw.IsBusy)
            {
                this.saveSettings();
                this.button3.Enabled = false;
                this.button4.Enabled = false;
                this.button4.Text = "Upgrading..";
                this.refreshThumblink.Enabled = false;
                this.refreshMIlink.Enabled = false;
                this.clearDBlink.Enabled = false;
                this.bgw = new BackgroundWorker();
                this.bgw.DoWork += new DoWorkEventHandler(this.bgw_DoUpgrade);
                this.bgw.ProgressChanged += new ProgressChangedEventHandler(this.bgw_ProgressChanged);
                this.bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.bgw_RunWorkerCompleted);
                this.bgw.WorkerReportsProgress = true;
                this.bgw.WorkerSupportsCancellation = true;
                this.db.bgw = this.bgw;
                this.bgw.RunWorkerAsync();
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (!this.bgw.IsBusy)
            {
                int num;
                this.saveSettings();
                if (!int.TryParse(this.thumbHeight.Text, out num))
                {
                    MessageBox.Show("Video Thumbnail height must be an integer.", "Thumbnail Height Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    this.bgw_RunWorkerCompleted(null, null);
                }
                else if ((double.Parse(this.thumbHeight.Text) % 2.0) != 0.0)
                {
                    int num2 = int.Parse(this.thumbHeight.Text) + 1;
                    num2 = int.Parse(this.thumbHeight.Text) - 1;
                    MessageBox.Show("Video Thumbnail height must be divisible by 2.  Change the value to either " + num2.ToString() + " or " + num2.ToString(), "Thumbnail Height Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    this.button4.Text = "Cancel Scan";
                    this.clearDBlink.Enabled = false;
                    this.refreshMIlink.Enabled = false;
                    this.refreshThumblink.Enabled = false;
                    this.bgw = new BackgroundWorker();
                    this.bgw.DoWork += new DoWorkEventHandler(this.bgw_DoWork);
                    this.bgw.ProgressChanged += new ProgressChangedEventHandler(this.bgw_ProgressChanged);
                    this.bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.bgw_RunWorkerCompleted);
                    this.bgw.WorkerReportsProgress = true;
                    this.bgw.WorkerSupportsCancellation = true;
                    this.db.bgw = this.bgw;
                    this.bgw.RunWorkerAsync();
                }
            }
            else
            {
                this.bgw.CancelAsync();
            }
        }

        private void button5_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you absolutely sure you want to clear your database?  This will remove all records in the database but will leave your files intact.", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                ProgressChangedEventArgs args;
                if (this.db.clearDB())
                {
                    args = new ProgressChangedEventArgs(0, "Cleared all information from Database");
                    this.bgw_ProgressChanged(null, args);
                }
                else
                {
                    args = new ProgressChangedEventArgs(0, "Error clearing information from Database");
                    this.bgw_ProgressChanged(null, args);
                }
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            this.saveSettings();
            new mVids.dbManager().ShowDialog();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            string[] strArray;
            if ((this.textBox2.Text != "") && (this.maskBox.Text != ""))
            {
                strArray = new string[2];
                strArray[0] = this.textBox2.Text;
                if (this.maskBox.Text.StartsWith(@"\"))
                {
                    this.maskBox.Text.Remove(0, 1);
                }
                strArray[1] = this.maskBox.Text;
                this.listView1.Items.Add(new ListViewItem(strArray));
            }
            else if ((this.textBox2.Text != "") && (this.maskBox.Text == ""))
            {
                strArray = new string[] { this.textBox2.Text, "IGNORE" };
                this.listView1.Items.Add(new ListViewItem(strArray));
            }
            Settings settings = new Settings(Config.GetFolder(Config.Dir.Config) + "/MediaPortal.xml", true);
            StringBuilder builder = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            for (int i = 0; i < this.listView1.Items.Count; i++)
            {
                string text = this.listView1.Items[i].SubItems[0].Text;
                if (Directory.Exists(text))
                {
                    builder.Append(text + "|");
                }
                builder2.Append(this.listView1.Items[i].SubItems[1].Text + "|");
            }
            settings.SetValue("mvid", "basepath", builder.ToString());
            settings.SetValue("mvid", "masks", builder2.ToString());
            settings.Dispose();
        }

        private void button8_Click(object sender, EventArgs e)
        {
            if (this.listView1.Items.IndexOf(this.listView1.SelectedItems[0]) >= 0)
            {
                this.listView1.Items.RemoveAt(this.listView1.Items.IndexOf(this.listView1.SelectedItems[0]));
            }
            Settings settings = new Settings(Config.GetFolder(Config.Dir.Config) + "/MediaPortal.xml", true);
            StringBuilder builder = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            for (int i = 0; i < this.listView1.Items.Count; i++)
            {
                string text = this.listView1.Items[i].SubItems[0].Text;
                if (Directory.Exists(text))
                {
                    builder.Append(text + "|");
                }
                builder2.Append(this.listView1.Items[i].SubItems[1].Text + "|");
            }
            settings.SetValue("mvid", "basepath", builder.ToString());
            settings.SetValue("mvid", "masks", builder2.ToString());
            settings.Dispose();
        }

        private void cleanupMultipleDlg()
        {
            if (!(this.choiceDialog.IsDisposed || (this.choiceDialog.flowLayoutPanel1.Controls.Count != 0)))
            {
                this.choiceDialog.Dispose();
            }
        }

        private void clearDBlink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (MessageBox.Show("Are you absolutely sure you want to clear your database?  This will remove all records in the database but will leave your files intact.", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                ProgressChangedEventArgs args;
                if (this.db.clearDB())
                {
                    args = new ProgressChangedEventArgs(0, "Cleared all information from Database");
                    this.bgw_ProgressChanged(null, args);
                }
                else
                {
                    args = new ProgressChangedEventArgs(0, "Error clearing information from Database");
                    this.bgw_ProgressChanged(null, args);
                }
            }
        }

        private void config_Load(object sender, EventArgs e)
        {
            bool flag;
            this.db.checkDB();
            Settings settings = new Settings(Config.GetFolder(Config.Dir.Config) + "/MediaPortal.xml", true);
            string[] strArray = settings.GetValue("mvid", "basepath").Split("|".ToCharArray());
            string str = settings.GetValue("mvid", "masks");
            string[] strArray2 = settings.GetValue("mvid", "masks").Split("|".ToCharArray());
            if (str == "")
            {
                flag = true;
            }
            else
            {
                flag = false;
            }
            for (int i = 0; i < strArray.Length; i++)
            {
                if (Directory.Exists(strArray[i]))
                {
                    string[] items = new string[2];
                    items[0] = strArray[i];
                    if (flag)
                    {
                        items[1] = "IGNORE";
                    }
                    else
                    {
                        items[1] = strArray2[i];
                    }
                    this.listView1.Items.Add(new ListViewItem(items));
                }
            }
            this.thumbInfoBox.Text = Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\Videos";
            this.artistInfoBox.Text = Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\Artists";
            this.fanartInfobox.Text = Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\FanArt";
            this.textBox1.Text = settings.GetValue("mvid", "ffmpeg");
            this.textBox3.Text = settings.GetValue("mvid", "thumbtime");
            string str2 = settings.GetValue("mvid", "bioLanguage");
            if (str2 != "")
            {
                this.langBox.Text = str2;
            }
            this.textBox6.Text = settings.GetValue("mvid", "mosaicsizewidth");
            if (this.textBox6.Text.Length == 0)
            {
                this.textBox6.Text = "100";
            }
            this.textBox7.Text = settings.GetValue("mvid", "mosaicsizeheight");
            if (this.textBox7.Text.Length == 0)
            {
                this.textBox7.Text = "75";
            }
            this.checkBox1.Checked = settings.GetValueAsBool("mvid", "autoqueueall", true);
            this.topLevelFanart.Checked = settings.GetValueAsBool("mvid", "toplevelfanart", true);
            this.top100KeyFanart.Checked = settings.GetValueAsBool("mvid", "top100keyfanart", true);
            this.viewDlgChk.Checked = settings.GetValueAsBool("mvid", "cycleviews", true);
            this.comboBox1.SelectedItem = settings.GetValue("mvid", "displayedbio");
            this.thumbHeight.Text = settings.GetValue("mvid", "thumbheight");
            if (this.thumbHeight.Text == "")
            {
                this.thumbHeight.Text = "350";
            }
            string str3 = settings.GetValue("mvid", "displayedname");
            if (str3.Length > 0)
            {
                this.textBox5.Text = str3;
            }
            else
            {
                this.textBox5.Text = "Music Video DB";
            }
            if (!Directory.Exists(Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\Artists"))
            {
                Directory.CreateDirectory(Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\Artists");
            }
            if (!Directory.Exists(Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\Videos"))
            {
                Directory.CreateDirectory(Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\Videos");
            }
            settings.Dispose();
            this.textBox4.Text = DateTime.Now.ToLongTimeString() + ": Configuration Opened" + Environment.NewLine;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private List<string> ExamineDir(string strDir, bool report)
        {
            int num = 0;
            Settings settings = new Settings(Config.GetFolder(Config.Dir.Config) + "/MediaPortal.xml", false);
            string str = settings.GetValue("movies", "extensions");
            settings.Dispose();
            if (report && !this.textBox4.Text.Contains("Looking for files with"))
            {
                Log.Debug("Music Video DB - ExamineDir looking for files with any of these extensions - {0}", new object[] { str });
                this.bgw.ReportProgress(1, "Looking for files with extension: " + str);
            }
            List<string> list = new List<string>();
            list.AddRange(str.Split(",".ToCharArray()));
            List<string> list2 = new List<string>();
            List<string> list3 = new List<string>();
            string[] files = Directory.GetFiles(strDir);
            foreach (string str2 in files)
            {
                try
                {
                    if (str2.Contains("."))
                    {
                        string item = str2.Substring(str2.LastIndexOf("."));
                        if (list.Contains(item))
                        {
                            list2.Add(str2.ToString());
                            num++;
                        }
                    }
                }
                catch (Exception exception)
                {
                    list3.Add(str2 + " : " + exception.ToString());
                }
            }
            foreach (string str4 in Directory.GetDirectories(strDir))
            {
                list2.AddRange(this.ExamineDir(str4, report));
            }
            Log.Info("Music Video DB - ExamineDir returned {0} files from {1}", new object[] { num.ToString(), strDir });
            if (list3.Count > 0)
            {
                foreach (string str5 in list3)
                {
                    Log.Error("Music Video DB - Error with {0}", new object[] { str5 });
                }
            }
            return list2;
        }

        private void getThumb(string video, double width)
        {
            string text = this.textBox3.Text;
            string str2 = Config.GetFolder(Config.Dir.Thumbs) + @"\mvids\Videos";
            string str3 = this.textBox1.Text;
            string str4 = video.Remove(0, video.LastIndexOf(@"\") + 1);
            if (!File.Exists(str2 + @"\Videos\" + str4 + ".jpg"))
            {
                try
                {
                    Process process = new Process();
                    if ((width % 2.0) != 0.0)
                    {
                        width++;
                    }
                    Log.Debug("Music Video DB - ffmpeg command line= -i \"" + video + "\" -s " + width.ToString() + "*" + this.thumbHeight.Text + " -ss " + text + " -vframes 1 -f image2 -vcodec mjpeg \"" + str2 + @"\" + str4 + ".jpg\"", new object[0]);
                    process.StartInfo.Arguments = " -i \"" + video + "\" -s " + width.ToString() + "*" + this.thumbHeight.Text + " -ss " + text + " -vframes 1 -f image2 -vcodec mjpeg \"" + str2 + @"\" + str4 + ".jpg\"";
                    process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    process.StartInfo.FileName = str3;
                    process.Start();
                    process.WaitForExit();
                    if (!(GUIWindowManager.Initalized || this.bgw.CancellationPending))
                    {
                        this.bgw.ReportProgress(1, "Grabbed thumbnail from " + str4);
                    }
                    Log.Info("Music Video DB - Thumbnail generated for {0}", new object[] { video });
                }
                catch (Exception exception)
                {
                    Log.Error("Music Video DB - Error generating video thumbnail for {0}, {1}", new object[] { video, exception.ToString() });
                }
            }
        }

        private List<mVids.musicVideo> getVideosForUpgrade()
        {
            try
            {
                SQLiteClient client = new SQLiteClient(Config.GetFolder(Config.Dir.Database) + @"\mvid.db3");
                SQLiteResultSet set = client.Execute("SELECT filename,artist,song,playcount,duration,rating,score FROM files ORDER BY key ASC");
                List<mVids.musicVideo> list = new List<mVids.musicVideo>();
                for (int i = 0; i < set.Rows.Count; i++)
                {
                    mVids.musicVideo item = new mVids.musicVideo();
                    item.Path = set.Rows[i].fields[0].ToString();
                    item.artist = set.Rows[i].fields[1].ToString();
                    item.Label = set.Rows[i].fields[2].ToString();
                    item.playcount = set.Rows[i].fields[3].ToString();
                    item.Duration = int.Parse(set.Rows[i].fields[4]);
                    item.rating = set.Rows[i].fields[5].ToString();
                    item.score = set.Rows[i].fields[6].ToString();
                    list.Add(item);
                    Log.Info("Music Video DB - Found in old DB: File={0}, Artist={1}, Song={2}, Playcount={3}, Rating={4}, Score={5}", new object[] { item.Path, item.artist, item.Label, item.playcount, item.rating, item.score });
                }
                client.Dispose();
                return list;
            }
            catch (Exception exception)
            {
                Log.Error("ERROR UPGRADING DB ------ {0}", new object[] { exception.ToString() });
                return null;
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(mVids.config));
            this.openFileDialog1 = new OpenFileDialog();
            this.folderBrowserDialog1 = new FolderBrowserDialog();
            this.textBox4 = new TextBox();
            this.button4 = new Button();
            this.button6 = new Button();
            this.tabControl1 = new TabControl();
            this.tabPage1 = new TabPage();
            this.linkLabel1 = new LinkLabel();
            this.langBox = new TextBox();
            this.fanartInfobox = new TextBox();
            this.label28 = new Label();
            this.artistInfoBox = new TextBox();
            this.label27 = new Label();
            this.thumbInfoBox = new TextBox();
            this.label18 = new Label();
            this.thumbHeight = new TextBox();
            this.label10 = new Label();
            this.viewDlgChk = new CheckBox();
            this.pictureBox1 = new PictureBox();
            this.refreshMIlink = new LinkLabel();
            this.refreshThumblink = new LinkLabel();
            this.clearDBlink = new LinkLabel();
            this.button3 = new Button();
            this.top100KeyFanart = new CheckBox();
            this.topLevelFanart = new CheckBox();
            this.comboBox1 = new ComboBox();
            this.label15 = new Label();
            this.label13 = new Label();
            this.label12 = new Label();
            this.textBox3 = new TextBox();
            this.label9 = new Label();
            this.label4 = new Label();
            this.button1 = new Button();
            this.textBox7 = new TextBox();
            this.label8 = new Label();
            this.label3 = new Label();
            this.label7 = new Label();
            this.label1 = new Label();
            this.label6 = new Label();
            this.textBox1 = new TextBox();
            this.textBox6 = new TextBox();
            this.textBox5 = new TextBox();
            this.checkBox1 = new CheckBox();
            this.label5 = new Label();
            this.tabPage2 = new TabPage();
            this.label30 = new Label();
            this.label29 = new Label();
            this.label14 = new Label();
            this.maskBox = new TextBox();
            this.label11 = new Label();
            this.listView1 = new ListView();
            this.columnHeader1 = new ColumnHeader();
            this.columnHeader2 = new ColumnHeader();
            this.label2 = new Label();
            this.checkBox2 = new CheckBox();
            this.checkBox3 = new CheckBox();
            this.label16 = new Label();
            this.textBox8 = new TextBox();
            this.label17 = new Label();
            this.button8 = new Button();
            this.button7 = new Button();
            this.button2 = new Button();
            this.textBox2 = new TextBox();
            this.pictureBox2 = new PictureBox();
            this.tabPage3 = new TabPage();
            this.splitContainer1 = new SplitContainer();
            this.scanningListbox = new ListBox();
            this.textBox11 = new TextBox();
            this.label19 = new Label();
            this.checkBox5 = new CheckBox();
            this.label20 = new Label();
            this.textBox12 = new TextBox();
            this.label21 = new Label();
            this.button5 = new Button();
            this.label22 = new Label();
            this.button9 = new Button();
            this.button10 = new Button();
            this.textBox13 = new TextBox();
            this.listBox2 = new ListBox();
            this.textBox14 = new TextBox();
            this.label23 = new Label();
            this.checkBox6 = new CheckBox();
            this.label24 = new Label();
            this.textBox15 = new TextBox();
            this.label25 = new Label();
            this.button11 = new Button();
            this.label26 = new Label();
            this.button12 = new Button();
            this.button13 = new Button();
            this.textBox16 = new TextBox();
            this.listBox3 = new ListBox();
            this.pictureBox3 = new PictureBox();
            this.pictureBox4 = new PictureBox();
            this.splitContainer2 = new SplitContainer();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            ((ISupportInitialize) this.pictureBox1).BeginInit();
            this.tabPage2.SuspendLayout();
            ((ISupportInitialize) this.pictureBox2).BeginInit();
            this.tabPage3.SuspendLayout();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            ((ISupportInitialize) this.pictureBox3).BeginInit();
            ((ISupportInitialize) this.pictureBox4).BeginInit();
            this.splitContainer2.Panel1.SuspendLayout();
            this.splitContainer2.Panel2.SuspendLayout();
            this.splitContainer2.SuspendLayout();
            base.SuspendLayout();
            this.openFileDialog1.FileName = "openFileDialog1";
            this.textBox4.BackColor = SystemColors.Window;
            this.textBox4.Dock = DockStyle.Fill;
            this.textBox4.Location = new Point(0, 0);
            this.textBox4.Multiline = true;
            this.textBox4.Name = "textBox4";
            this.textBox4.ReadOnly = true;
            this.textBox4.ScrollBars = ScrollBars.Both;
            this.textBox4.Size = new Size(0x2d2, 150);
            this.textBox4.TabIndex = 12;
            this.button4.BackColor = SystemColors.ButtonFace;
            this.button4.FlatStyle = FlatStyle.Flat;
            this.button4.Location = new Point(0x23, 0xa3);
            this.button4.Name = "button4";
            this.button4.Size = new Size(0x4a, 0x2d);
            this.button4.TabIndex = 0x17;
            this.button4.Text = "Refresh Database";
            this.button4.UseVisualStyleBackColor = false;
            this.button4.Click += new EventHandler(this.button4_Click);
            this.button6.BackColor = Color.Black;
            this.button6.FlatStyle = FlatStyle.Flat;
            this.button6.ForeColor = Color.White;
            this.button6.Location = new Point(0x23, 0xde);
            this.button6.Name = "button6";
            this.button6.Size = new Size(0x4a, 0x2d);
            this.button6.TabIndex = 0x19;
            this.button6.Text = "Manage Database";
            this.button6.UseVisualStyleBackColor = false;
            this.button6.Click += new EventHandler(this.button6_Click);
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Controls.Add(this.tabPage3);
            this.tabControl1.Dock = DockStyle.Fill;
            this.tabControl1.Location = new Point(0, 0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new Size(0x2d2, 0x1c3);
            this.tabControl1.TabIndex = 0x24;
            this.tabPage1.AutoScroll = true;
            this.tabPage1.BackColor = SystemColors.ControlLight;
            this.tabPage1.Controls.Add(this.linkLabel1);
            this.tabPage1.Controls.Add(this.langBox);
            this.tabPage1.Controls.Add(this.fanartInfobox);
            this.tabPage1.Controls.Add(this.label28);
            this.tabPage1.Controls.Add(this.artistInfoBox);
            this.tabPage1.Controls.Add(this.label27);
            this.tabPage1.Controls.Add(this.thumbInfoBox);
            this.tabPage1.Controls.Add(this.label18);
            this.tabPage1.Controls.Add(this.thumbHeight);
            this.tabPage1.Controls.Add(this.label10);
            this.tabPage1.Controls.Add(this.viewDlgChk);
            this.tabPage1.Controls.Add(this.pictureBox1);
            this.tabPage1.Controls.Add(this.refreshMIlink);
            this.tabPage1.Controls.Add(this.refreshThumblink);
            this.tabPage1.Controls.Add(this.clearDBlink);
            this.tabPage1.Controls.Add(this.button3);
            this.tabPage1.Controls.Add(this.top100KeyFanart);
            this.tabPage1.Controls.Add(this.topLevelFanart);
            this.tabPage1.Controls.Add(this.comboBox1);
            this.tabPage1.Controls.Add(this.button6);
            this.tabPage1.Controls.Add(this.button4);
            this.tabPage1.Controls.Add(this.label15);
            this.tabPage1.Controls.Add(this.label13);
            this.tabPage1.Controls.Add(this.label12);
            this.tabPage1.Controls.Add(this.textBox3);
            this.tabPage1.Controls.Add(this.label9);
            this.tabPage1.Controls.Add(this.label4);
            this.tabPage1.Controls.Add(this.button1);
            this.tabPage1.Controls.Add(this.textBox7);
            this.tabPage1.Controls.Add(this.label8);
            this.tabPage1.Controls.Add(this.label3);
            this.tabPage1.Controls.Add(this.label7);
            this.tabPage1.Controls.Add(this.label1);
            this.tabPage1.Controls.Add(this.label6);
            this.tabPage1.Controls.Add(this.textBox1);
            this.tabPage1.Controls.Add(this.textBox6);
            this.tabPage1.Controls.Add(this.textBox5);
            this.tabPage1.Controls.Add(this.checkBox1);
            this.tabPage1.Controls.Add(this.label5);
            this.tabPage1.Location = new Point(4, 0x16);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new Padding(3);
            this.tabPage1.Size = new Size(0x2ca, 0x1a9);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "General";
            this.linkLabel1.AutoSize = true;
            this.linkLabel1.Location = new Point(0x22d, 0xac);
            this.linkLabel1.Name = "linkLabel1";
            this.linkLabel1.Size = new Size(0x69, 13);
            this.linkLabel1.TabIndex = 0x3f;
            this.linkLabel1.TabStop = true;
            this.linkLabel1.Text = "Biography Language";
            this.linkLabel1.TextAlign = ContentAlignment.TopCenter;
            this.linkLabel1.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked_1);
            this.langBox.AcceptsTab = true;
            this.langBox.Location = new Point(0x24f, 190);
            this.langBox.MaxLength = 2;
            this.langBox.Name = "langBox";
            this.langBox.Size = new Size(0x22, 20);
            this.langBox.TabIndex = 0x3e;
            this.langBox.Text = "en";
            this.fanartInfobox.Location = new Point(0x99, 0x17e);
            this.fanartInfobox.Name = "fanartInfobox";
            this.fanartInfobox.ReadOnly = true;
            this.fanartInfobox.Size = new Size(0x210, 20);
            this.fanartInfobox.TabIndex = 60;
            this.label28.AutoSize = true;
            this.label28.Location = new Point(0x97, 0x16e);
            this.label28.Name = "label28";
            this.label28.Size = new Size(0x67, 13);
            this.label28.TabIndex = 0x3b;
            this.label28.Text = "Fan Art Images Path";
            this.artistInfoBox.Location = new Point(0x99, 340);
            this.artistInfoBox.Name = "artistInfoBox";
            this.artistInfoBox.ReadOnly = true;
            this.artistInfoBox.Size = new Size(0x210, 20);
            this.artistInfoBox.TabIndex = 0x3a;
            this.label27.AutoSize = true;
            this.label27.Location = new Point(150, 0x144);
            this.label27.Name = "label27";
            this.label27.Size = new Size(0x5c, 13);
            this.label27.TabIndex = 0x39;
            this.label27.Text = "Artist Images Path";
            this.thumbInfoBox.Location = new Point(0x99, 0x12b);
            this.thumbInfoBox.Name = "thumbInfoBox";
            this.thumbInfoBox.ReadOnly = true;
            this.thumbInfoBox.Size = new Size(0x210, 20);
            this.thumbInfoBox.TabIndex = 0x38;
            this.label18.AutoSize = true;
            this.label18.Location = new Point(150, 0x11b);
            this.label18.Name = "label18";
            this.label18.Size = new Size(0x74, 13);
            this.label18.TabIndex = 0x37;
            this.label18.Text = "Video Thumbnails Path";
            this.thumbHeight.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.thumbHeight.Location = new Point(0x20d, 0x76);
            this.thumbHeight.MinimumSize = new Size(0x2b, 20);
            this.thumbHeight.Name = "thumbHeight";
            this.thumbHeight.Size = new Size(60, 20);
            this.thumbHeight.TabIndex = 0x35;
            this.label10.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label10.AutoSize = true;
            this.label10.Location = new Point(0x1bb, 0x79);
            this.label10.Name = "label10";
            this.label10.Size = new Size(0x4d, 13);
            this.label10.TabIndex = 0x36;
            this.label10.Text = "Thumb Height:";
            this.viewDlgChk.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.viewDlgChk.Location = new Point(0x20d, 0xe5);
            this.viewDlgChk.Name = "viewDlgChk";
            this.viewDlgChk.Size = new Size(0x9c, 0x2b);
            this.viewDlgChk.TabIndex = 0x34;
            this.viewDlgChk.Text = "Cycle views rather than\r\ndisplaying a View-Mode\r\nselection Dialog.";
            this.viewDlgChk.UseVisualStyleBackColor = true;
            this.pictureBox1.Image = mVids.Properties.Resources.mvids_logo;
            this.pictureBox1.Location = new Point(0x17, 15);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new Size(100, 40);
            this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
            this.pictureBox1.TabIndex = 0x33;
            this.pictureBox1.TabStop = false;
            this.refreshMIlink.AutoSize = true;
            this.refreshMIlink.Location = new Point(0x1b, 0x80);
            this.refreshMIlink.Name = "refreshMIlink";
            this.refreshMIlink.Size = new Size(0x5d, 13);
            this.refreshMIlink.TabIndex = 0x2f;
            this.refreshMIlink.TabStop = true;
            this.refreshMIlink.Text = "Refresh Mediainfo";
            this.refreshMIlink.LinkClicked += new LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
            this.refreshThumblink.AutoSize = true;
            this.refreshThumblink.Location = new Point(0x17, 0x63);
            this.refreshThumblink.Name = "refreshThumblink";
            this.refreshThumblink.Size = new Size(0x65, 13);
            this.refreshThumblink.TabIndex = 0x2e;
            this.refreshThumblink.TabStop = true;
            this.refreshThumblink.Text = "Refresh Thumbnails";
            this.refreshThumblink.LinkClicked += new LinkLabelLinkClickedEventHandler(this.refreshThumblink_LinkClicked);
            this.clearDBlink.AutoSize = true;
            this.clearDBlink.Location = new Point(0x21, 0x47);
            this.clearDBlink.Name = "clearDBlink";
            this.clearDBlink.Size = new Size(80, 13);
            this.clearDBlink.TabIndex = 0x2d;
            this.clearDBlink.TabStop = true;
            this.clearDBlink.Text = "Clear Database";
            this.clearDBlink.LinkClicked += new LinkLabelLinkClickedEventHandler(this.clearDBlink_LinkClicked);
            this.button3.Location = new Point(0x23, 0x11e);
            this.button3.Name = "button3";
            this.button3.Size = new Size(0x4a, 0x27);
            this.button3.TabIndex = 0x29;
            this.button3.Text = "Ugrade Database";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new EventHandler(this.button3_Click_1);
            this.top100KeyFanart.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.top100KeyFanart.Location = new Point(0x99, 0xeb);
            this.top100KeyFanart.Name = "top100KeyFanart";
            this.top100KeyFanart.Size = new Size(0x9b, 30);
            this.top100KeyFanart.TabIndex = 0x2c;
            this.top100KeyFanart.Text = "Enable Fan Art in Top 100 \r\nand Most Recent views.";
            this.top100KeyFanart.UseVisualStyleBackColor = true;
            this.topLevelFanart.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.topLevelFanart.Location = new Point(330, 0xeb);
            this.topLevelFanart.Name = "topLevelFanart";
            this.topLevelFanart.Size = new Size(0xab, 30);
            this.topLevelFanart.TabIndex = 0x2b;
            this.topLevelFanart.Text = "Enable Fan Art in Artist View.";
            this.topLevelFanart.UseVisualStyleBackColor = true;
            this.comboBox1.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.comboBox1.FormattingEnabled = true;
            this.comboBox1.Items.AddRange(new object[] { "Summary", "Full" });
            this.comboBox1.Location = new Point(0x1a1, 190);
            this.comboBox1.Name = "comboBox1";
            this.comboBox1.Size = new Size(0x76, 0x15);
            this.comboBox1.TabIndex = 40;
            this.label15.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label15.AutoSize = true;
            this.label15.Location = new Point(0x19e, 0xac);
            this.label15.Name = "label15";
            this.label15.Size = new Size(0x7e, 13);
            this.label15.TabIndex = 0x27;
            this.label15.Text = "Artist biography to display";
            this.label13.AutoSize = true;
            this.label13.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label13.Location = new Point(0x83, 0x92);
            this.label13.Name = "label13";
            this.label13.Size = new Size(0x52, 20);
            this.label13.TabIndex = 0x25;
            this.label13.Text = "Interface";
            this.label13.TextAlign = ContentAlignment.MiddleCenter;
            this.label12.AutoSize = true;
            this.label12.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label12.Location = new Point(0x84, 0x11);
            this.label12.Name = "label12";
            this.label12.Size = new Size(0x39, 20);
            this.label12.TabIndex = 0x24;
            this.label12.Text = "Setup";
            this.textBox3.Location = new Point(0xe0, 0x76);
            this.textBox3.MinimumSize = new Size(0x2b, 20);
            this.textBox3.Name = "textBox3";
            this.textBox3.Size = new Size(0x2b, 20);
            this.textBox3.TabIndex = 20;
            this.label9.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label9.AutoSize = true;
            this.label9.Location = new Point(0x143, 0xc2);
            this.label9.Name = "label9";
            this.label9.Size = new Size(15, 13);
            this.label9.TabIndex = 0x23;
            this.label9.Text = "H";
            this.label4.AutoSize = true;
            this.label4.Location = new Point(0x111, 0x79);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x23, 13);
            this.label4.TabIndex = 0x16;
            this.label4.Text = "(secs)";
            this.button1.Location = new Point(0x24f, 0x52);
            this.button1.Name = "button1";
            this.button1.Size = new Size(0x2e, 0x17);
            this.button1.TabIndex = 15;
            this.button1.Text = "Open";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new EventHandler(this.button1_Click);
            this.textBox7.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.textBox7.Location = new Point(0x158, 0xbf);
            this.textBox7.MaximumSize = new Size(0x29, 20);
            this.textBox7.MinimumSize = new Size(0x29, 20);
            this.textBox7.Name = "textBox7";
            this.textBox7.Size = new Size(0x29, 20);
            this.textBox7.TabIndex = 0x22;
            this.label8.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label8.AutoSize = true;
            this.label8.Location = new Point(0x137, 0xc0);
            this.label8.Name = "label8";
            this.label8.Size = new Size(12, 13);
            this.label8.TabIndex = 0x21;
            this.label8.Text = "x";
            this.label3.AutoSize = true;
            this.label3.Location = new Point(0x98, 0x79);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x45, 13);
            this.label3.TabIndex = 0x15;
            this.label3.Text = "Thumb Time:";
            this.label7.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label7.AutoSize = true;
            this.label7.Location = new Point(0xf5, 0xc2);
            this.label7.Name = "label7";
            this.label7.Size = new Size(0x12, 13);
            this.label7.TabIndex = 0x20;
            this.label7.Text = "W";
            this.label1.AutoSize = true;
            this.label1.Location = new Point(0x99, 0x56);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x43, 13);
            this.label1.TabIndex = 14;
            this.label1.Text = "ffmpeg Path:";
            this.label6.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label6.AutoSize = true;
            this.label6.Location = new Point(0x110, 0xac);
            this.label6.Name = "label6";
            this.label6.Size = new Size(100, 13);
            this.label6.TabIndex = 0x1f;
            this.label6.Text = "Mosaic Thumb Size";
            this.textBox1.Location = new Point(0xdf, 0x53);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new Size(0x16a, 20);
            this.textBox1.TabIndex = 13;
            this.textBox6.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.textBox6.Location = new Point(0x10b, 0xbf);
            this.textBox6.MaximumSize = new Size(0x29, 20);
            this.textBox6.MinimumSize = new Size(0x29, 20);
            this.textBox6.Name = "textBox6";
            this.textBox6.Size = new Size(0x29, 20);
            this.textBox6.TabIndex = 30;
            this.textBox5.Location = new Point(0xdf, 0x2e);
            this.textBox5.Name = "textBox5";
            this.textBox5.Size = new Size(0x16a, 20);
            this.textBox5.TabIndex = 0x1a;
            this.checkBox1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.checkBox1.AutoSize = true;
            this.checkBox1.Checked = true;
            this.checkBox1.CheckState = CheckState.Checked;
            this.checkBox1.ImageAlign = ContentAlignment.MiddleLeft;
            this.checkBox1.Location = new Point(0x9a, 0xb5);
            this.checkBox1.Name = "checkBox1";
            this.checkBox1.Size = new Size(0x56, 30);
            this.checkBox1.TabIndex = 0x1c;
            this.checkBox1.Text = "Auto Queue \r\nEntire Folder";
            this.checkBox1.UseVisualStyleBackColor = true;
            this.label5.AutoSize = true;
            this.label5.Location = new Point(0x85, 0x31);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x57, 13);
            this.label5.TabIndex = 0x1b;
            this.label5.Text = "Displayed Name:";
            this.tabPage2.AutoScroll = true;
            this.tabPage2.BackColor = SystemColors.ControlLight;
            this.tabPage2.Controls.Add(this.label30);
            this.tabPage2.Controls.Add(this.label29);
            this.tabPage2.Controls.Add(this.label14);
            this.tabPage2.Controls.Add(this.maskBox);
            this.tabPage2.Controls.Add(this.label11);
            this.tabPage2.Controls.Add(this.listView1);
            this.tabPage2.Controls.Add(this.label2);
            this.tabPage2.Controls.Add(this.checkBox2);
            this.tabPage2.Controls.Add(this.checkBox3);
            this.tabPage2.Controls.Add(this.label16);
            this.tabPage2.Controls.Add(this.textBox8);
            this.tabPage2.Controls.Add(this.label17);
            this.tabPage2.Controls.Add(this.button8);
            this.tabPage2.Controls.Add(this.button7);
            this.tabPage2.Controls.Add(this.button2);
            this.tabPage2.Controls.Add(this.textBox2);
            this.tabPage2.Controls.Add(this.pictureBox2);
            this.tabPage2.ForeColor = SystemColors.ControlText;
            this.tabPage2.Location = new Point(4, 0x16);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new Padding(3);
            this.tabPage2.Size = new Size(0x2ca, 0x1a9);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "Scanning";
            this.label30.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.label30.Location = new Point(0x60, 0x66);
            this.label30.Name = "label30";
            this.label30.Size = new Size(0xa8, 0x1a);
            this.label30.TabIndex = 0x18;
            this.label30.Text = "Blank folder mask ignores folder names.";
            this.label30.TextAlign = ContentAlignment.MiddleLeft;
            this.label29.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label29.AutoSize = true;
            this.label29.Font = new Font("Microsoft Sans Serif", 6.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label29.Location = new Point(0x188, 0x24);
            this.label29.Name = "label29";
            this.label29.Size = new Size(0x8a, 0x54);
            this.label29.TabIndex = 0x17;
            this.label29.Text = "Folder Mask Variables\r\n\r\n%tags% - Tag Value\r\n%artist% - Name of Artist\r\n%last.fm% - last.fm Artist Name\r\n\r\nExample - %tags\\%artist%\\";
            this.label14.Anchor = AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top;
            this.label14.Location = new Point(0x220, 10);
            this.label14.Name = "label14";
            this.label14.Size = new Size(0xa4, 0x11c);
            this.label14.TabIndex = 0x16;
            this.label14.Text = manager.GetString("label14.Text");
            this.maskBox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.maskBox.Location = new Point(0x63, 0x4a);
            this.maskBox.Name = "maskBox";
            this.maskBox.Size = new Size(0x11f, 20);
            this.maskBox.TabIndex = 0x15;
            this.label11.AutoSize = true;
            this.label11.Font = new Font("Microsoft Sans Serif", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
            this.label11.Location = new Point(10, 0x4e);
            this.label11.Name = "label11";
            this.label11.Size = new Size(0x53, 0x10);
            this.label11.TabIndex = 20;
            this.label11.Text = "Folder Mask";
            this.listView1.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.listView1.Columns.AddRange(new ColumnHeader[] { this.columnHeader1, this.columnHeader2 });
            this.listView1.Location = new Point(8, 0x86);
            this.listView1.Name = "listView1";
            this.listView1.Size = new Size(0x215, 0xce);
            this.listView1.TabIndex = 0x13;
            this.listView1.UseCompatibleStateImageBehavior = false;
            this.listView1.View = View.Details;
            this.columnHeader1.Text = "Path";
            this.columnHeader1.Width = 0x11a;
            this.columnHeader2.Text = "Mask";
            this.columnHeader2.Width = 210;
            this.label2.AutoSize = true;
            this.label2.BackColor = SystemColors.ControlLight;
            this.label2.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label2.ForeColor = SystemColors.ControlText;
            this.label2.Location = new Point(6, 10);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x1e2, 20);
            this.label2.TabIndex = 4;
            this.label2.Text = "Add all root folders that should be checked when scanning.";
            this.checkBox2.AutoSize = true;
            this.checkBox2.Checked = true;
            this.checkBox2.CheckState = CheckState.Checked;
            this.checkBox2.Enabled = false;
            this.checkBox2.Font = new Font("Microsoft Sans Serif", 8.25f);
            this.checkBox2.Location = new Point(0x1db, 350);
            this.checkBox2.Name = "checkBox2";
            this.checkBox2.Size = new Size(200, 0x11);
            this.checkBox2.TabIndex = 0x12;
            this.checkBox2.Text = "Grab and save artist tags from last.fm";
            this.checkBox2.UseVisualStyleBackColor = true;
            this.checkBox2.Visible = false;
            this.checkBox3.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.checkBox3.AutoSize = true;
            this.checkBox3.Location = new Point(0x123, 0x183);
            this.checkBox3.Name = "checkBox3";
            this.checkBox3.Size = new Size(0x25, 0x11);
            this.checkBox3.TabIndex = 11;
            this.checkBox3.Text = "All";
            this.checkBox3.UseVisualStyleBackColor = true;
            this.label16.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label16.AutoSize = true;
            this.label16.Location = new Point(13, 0x183);
            this.label16.Name = "label16";
            this.label16.Size = new Size(0xd7, 13);
            this.label16.TabIndex = 10;
            this.label16.Text = "Max # of tags from last.fm to save on import:";
            this.textBox8.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.textBox8.Location = new Point(0xf6, 0x180);
            this.textBox8.Name = "textBox8";
            this.textBox8.Size = new Size(0x27, 20);
            this.textBox8.TabIndex = 9;
            this.textBox8.Text = "10";
            this.label17.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label17.AutoSize = true;
            this.label17.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label17.Location = new Point(12, 0x164);
            this.label17.Name = "label17";
            this.label17.Size = new Size(0x30, 20);
            this.label17.TabIndex = 7;
            this.label17.Text = "Tags";
            this.button8.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.button8.BackColor = SystemColors.ControlLight;
            this.button8.ForeColor = SystemColors.ControlText;
            this.button8.Location = new Point(270, 0x69);
            this.button8.Name = "button8";
            this.button8.Size = new Size(0x37, 0x17);
            this.button8.TabIndex = 5;
            this.button8.Text = "Delete";
            this.button8.UseVisualStyleBackColor = false;
            this.button8.Click += new EventHandler(this.button8_Click);
            this.button7.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.button7.BackColor = SystemColors.ControlLight;
            this.button7.ForeColor = SystemColors.ControlText;
            this.button7.Location = new Point(0x14b, 0x69);
            this.button7.Name = "button7";
            this.button7.Size = new Size(0x37, 0x17);
            this.button7.TabIndex = 3;
            this.button7.Text = "Add";
            this.button7.UseVisualStyleBackColor = false;
            this.button7.Click += new EventHandler(this.button7_Click);
            this.button2.BackColor = SystemColors.ControlLight;
            this.button2.ForeColor = SystemColors.ControlText;
            this.button2.Location = new Point(11, 0x2e);
            this.button2.Name = "button2";
            this.button2.Size = new Size(0x52, 0x17);
            this.button2.TabIndex = 2;
            this.button2.Text = "Select Folder";
            this.button2.UseVisualStyleBackColor = false;
            this.button2.Click += new EventHandler(this.button2_Click);
            this.textBox2.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.textBox2.BackColor = SystemColors.Window;
            this.textBox2.ForeColor = SystemColors.ControlText;
            this.textBox2.Location = new Point(0x63, 0x30);
            this.textBox2.Name = "textBox2";
            this.textBox2.Size = new Size(0x11f, 20);
            this.textBox2.TabIndex = 1;
            this.pictureBox2.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.pictureBox2.Image = mVids.Properties.Resources.lastfm;
            this.pictureBox2.Location = new Point(0x1f8, 0x163);
            this.pictureBox2.Name = "pictureBox2";
            this.pictureBox2.Size = new Size(200, 60);
            this.pictureBox2.SizeMode = PictureBoxSizeMode.AutoSize;
            this.pictureBox2.TabIndex = 6;
            this.pictureBox2.TabStop = false;
            this.tabPage3.Controls.Add(this.splitContainer1);
            this.tabPage3.Location = new Point(4, 0x16);
            this.tabPage3.Name = "tabPage3";
            this.tabPage3.Padding = new Padding(3);
            this.tabPage3.Size = new Size(0x2ca, 0x1a9);
            this.tabPage3.TabIndex = 2;
            this.tabPage3.Text = "Parse Test";
            this.tabPage3.UseVisualStyleBackColor = true;
            this.splitContainer1.BorderStyle = BorderStyle.FixedSingle;
            this.splitContainer1.Dock = DockStyle.Fill;
            this.splitContainer1.Location = new Point(3, 3);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Panel1.Controls.Add(this.scanningListbox);
            this.splitContainer1.Size = new Size(0x2c4, 0x1a3);
            this.splitContainer1.SplitterDistance = 0xa4;
            this.splitContainer1.TabIndex = 0;
            this.scanningListbox.Dock = DockStyle.Fill;
            this.scanningListbox.FormattingEnabled = true;
            this.scanningListbox.Items.AddRange(new object[] { "View Parsing Results" });
            this.scanningListbox.Location = new Point(0, 0);
            this.scanningListbox.Name = "scanningListbox";
            this.scanningListbox.Size = new Size(0xa2, 0x197);
            this.scanningListbox.TabIndex = 0;
            this.scanningListbox.SelectedIndexChanged += new EventHandler(this.scanningListbox_SelectedIndexChanged);
            this.textBox11.Location = new Point(11, 0xe7);
            this.textBox11.Name = "textBox11";
            this.textBox11.Size = new Size(0x125, 20);
            this.textBox11.TabIndex = 13;
            this.label19.AutoSize = true;
            this.label19.Location = new Point(8, 0xd7);
            this.label19.Name = "label19";
            this.label19.Size = new Size(0x5b, 13);
            this.label19.TabIndex = 12;
            this.label19.Text = "Video Thumbnails";
            this.checkBox5.AutoSize = true;
            this.checkBox5.Location = new Point(0x1de, 0x156);
            this.checkBox5.Name = "checkBox5";
            this.checkBox5.Size = new Size(0x25, 0x11);
            this.checkBox5.TabIndex = 11;
            this.checkBox5.Text = "All";
            this.checkBox5.UseVisualStyleBackColor = true;
            this.label20.AutoSize = true;
            this.label20.Location = new Point(0x1a3, 0x143);
            this.label20.Name = "label20";
            this.label20.Size = new Size(0x9c, 13);
            this.label20.TabIndex = 10;
            this.label20.Text = "Max # of tags to save on import";
            this.textBox12.Location = new Point(0x1a6, 0x153);
            this.textBox12.Name = "textBox12";
            this.textBox12.Size = new Size(0x26, 20);
            this.textBox12.TabIndex = 9;
            this.textBox12.Text = "10";
            this.label21.AutoSize = true;
            this.label21.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label21.Location = new Point(0x1da, 290);
            this.label21.Name = "label21";
            this.label21.Size = new Size(0x30, 20);
            this.label21.TabIndex = 7;
            this.label21.Text = "Tags";
            this.button5.BackColor = SystemColors.ControlLight;
            this.button5.Location = new Point(560, 10);
            this.button5.Name = "button5";
            this.button5.Size = new Size(0x37, 0x17);
            this.button5.TabIndex = 5;
            this.button5.Text = "Delete";
            this.button5.UseVisualStyleBackColor = false;
            this.label22.AutoSize = true;
            this.label22.BackColor = SystemColors.ControlLight;
            this.label22.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label22.Location = new Point(6, 10);
            this.label22.Name = "label22";
            this.label22.Size = new Size(0x1e2, 20);
            this.label22.TabIndex = 4;
            this.label22.Text = "Add all root folders that should be checked when scanning.";
            this.button9.BackColor = SystemColors.ControlLight;
            this.button9.Location = new Point(560, 0x29);
            this.button9.Name = "button9";
            this.button9.Size = new Size(0x37, 0x17);
            this.button9.TabIndex = 3;
            this.button9.Text = "Add";
            this.button9.UseVisualStyleBackColor = false;
            this.button10.BackColor = SystemColors.ControlLight;
            this.button10.Location = new Point(490, 0x29);
            this.button10.Name = "button10";
            this.button10.Size = new Size(0x40, 0x17);
            this.button10.TabIndex = 2;
            this.button10.Text = "Open";
            this.button10.UseVisualStyleBackColor = false;
            this.textBox13.BackColor = SystemColors.Window;
            this.textBox13.Location = new Point(8, 0x29);
            this.textBox13.Name = "textBox13";
            this.textBox13.Size = new Size(0x1d8, 20);
            this.textBox13.TabIndex = 1;
            this.listBox2.FormattingEnabled = true;
            this.listBox2.HorizontalScrollbar = true;
            this.listBox2.Location = new Point(6, 0x49);
            this.listBox2.Name = "listBox2";
            this.listBox2.Size = new Size(0x263, 0x79);
            this.listBox2.TabIndex = 0;
            this.textBox14.Location = new Point(11, 0xe7);
            this.textBox14.Name = "textBox14";
            this.textBox14.Size = new Size(0x125, 20);
            this.textBox14.TabIndex = 13;
            this.label23.AutoSize = true;
            this.label23.Location = new Point(8, 0xd7);
            this.label23.Name = "label23";
            this.label23.Size = new Size(0x5b, 13);
            this.label23.TabIndex = 12;
            this.label23.Text = "Video Thumbnails";
            this.checkBox6.AutoSize = true;
            this.checkBox6.Location = new Point(0x1de, 0x156);
            this.checkBox6.Name = "checkBox6";
            this.checkBox6.Size = new Size(0x25, 0x11);
            this.checkBox6.TabIndex = 11;
            this.checkBox6.Text = "All";
            this.checkBox6.UseVisualStyleBackColor = true;
            this.label24.AutoSize = true;
            this.label24.Location = new Point(0x1a3, 0x143);
            this.label24.Name = "label24";
            this.label24.Size = new Size(0x9c, 13);
            this.label24.TabIndex = 10;
            this.label24.Text = "Max # of tags to save on import";
            this.textBox15.Location = new Point(0x1a6, 0x153);
            this.textBox15.Name = "textBox15";
            this.textBox15.Size = new Size(0x26, 20);
            this.textBox15.TabIndex = 9;
            this.textBox15.Text = "10";
            this.label25.AutoSize = true;
            this.label25.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label25.Location = new Point(0x1da, 290);
            this.label25.Name = "label25";
            this.label25.Size = new Size(0x30, 20);
            this.label25.TabIndex = 7;
            this.label25.Text = "Tags";
            this.button11.BackColor = SystemColors.ControlLight;
            this.button11.Location = new Point(560, 10);
            this.button11.Name = "button11";
            this.button11.Size = new Size(0x37, 0x17);
            this.button11.TabIndex = 5;
            this.button11.Text = "Delete";
            this.button11.UseVisualStyleBackColor = false;
            this.label26.AutoSize = true;
            this.label26.BackColor = SystemColors.ControlLight;
            this.label26.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.label26.Location = new Point(6, 10);
            this.label26.Name = "label26";
            this.label26.Size = new Size(0x1e2, 20);
            this.label26.TabIndex = 4;
            this.label26.Text = "Add all root folders that should be checked when scanning.";
            this.button12.BackColor = SystemColors.ControlLight;
            this.button12.Location = new Point(560, 0x29);
            this.button12.Name = "button12";
            this.button12.Size = new Size(0x37, 0x17);
            this.button12.TabIndex = 3;
            this.button12.Text = "Add";
            this.button12.UseVisualStyleBackColor = false;
            this.button13.BackColor = SystemColors.ControlLight;
            this.button13.Location = new Point(490, 0x29);
            this.button13.Name = "button13";
            this.button13.Size = new Size(0x40, 0x17);
            this.button13.TabIndex = 2;
            this.button13.Text = "Open";
            this.button13.UseVisualStyleBackColor = false;
            this.textBox16.BackColor = SystemColors.Window;
            this.textBox16.Location = new Point(8, 0x29);
            this.textBox16.Name = "textBox16";
            this.textBox16.Size = new Size(0x1d8, 20);
            this.textBox16.TabIndex = 1;
            this.listBox3.FormattingEnabled = true;
            this.listBox3.HorizontalScrollbar = true;
            this.listBox3.Location = new Point(6, 0x49);
            this.listBox3.Name = "listBox3";
            this.listBox3.Size = new Size(0x263, 0x79);
            this.listBox3.TabIndex = 0;
            this.pictureBox3.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.pictureBox3.Image = mVids.Properties.Resources.lastfm;
            this.pictureBox3.Location = new Point(0x18e, 0xd7);
            this.pictureBox3.Name = "pictureBox3";
            this.pictureBox3.Size = new Size(200, 60);
            this.pictureBox3.SizeMode = PictureBoxSizeMode.AutoSize;
            this.pictureBox3.TabIndex = 6;
            this.pictureBox3.TabStop = false;
            this.pictureBox4.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.pictureBox4.Image = mVids.Properties.Resources.lastfm;
            this.pictureBox4.Location = new Point(0x18e, 0xd7);
            this.pictureBox4.Name = "pictureBox4";
            this.pictureBox4.Size = new Size(200, 60);
            this.pictureBox4.SizeMode = PictureBoxSizeMode.AutoSize;
            this.pictureBox4.TabIndex = 6;
            this.pictureBox4.TabStop = false;
            this.splitContainer2.Dock = DockStyle.Fill;
            this.splitContainer2.Location = new Point(0, 0);
            this.splitContainer2.Name = "splitContainer2";
            this.splitContainer2.Orientation = Orientation.Horizontal;
            this.splitContainer2.Panel1.Controls.Add(this.tabControl1);
            this.splitContainer2.Panel2.Controls.Add(this.textBox4);
            this.splitContainer2.Size = new Size(0x2d2, 0x25d);
            this.splitContainer2.SplitterDistance = 0x1c3;
            this.splitContainer2.TabIndex = 0x25;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            this.AutoSize = true;
            this.BackColor = SystemColors.ControlLight;
            base.ClientSize = new Size(0x2d2, 0x25d);
            base.Controls.Add(this.splitContainer2);
            base.MaximizeBox = false;
            base.Name = "config";
            base.SizeGripStyle = SizeGripStyle.Hide;
            this.Text = "mVids Configuration";
            base.Load += new EventHandler(this.config_Load);
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabPage1.PerformLayout();
            ((ISupportInitialize) this.pictureBox1).EndInit();
            this.tabPage2.ResumeLayout(false);
            this.tabPage2.PerformLayout();
            ((ISupportInitialize) this.pictureBox2).EndInit();
            this.tabPage3.ResumeLayout(false);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.ResumeLayout(false);
            ((ISupportInitialize) this.pictureBox3).EndInit();
            ((ISupportInitialize) this.pictureBox4).EndInit();
            this.splitContainer2.Panel1.ResumeLayout(false);
            this.splitContainer2.Panel2.ResumeLayout(false);
            this.splitContainer2.Panel2.PerformLayout();
            this.splitContainer2.ResumeLayout(false);
            base.ResumeLayout(false);
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.bgw = new BackgroundWorker();
            this.bgw.DoWork += new DoWorkEventHandler(this.refreshMediaInfo);
            this.bgw.ProgressChanged += new ProgressChangedEventHandler(this.bgw_ProgressChanged);
            this.bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.bgw_RunWorkerCompleted);
            this.bgw.WorkerReportsProgress = true;
            this.db.bgw = this.bgw;
            this.bgw.RunWorkerAsync();
        }

        private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
        {
            new mVids.aboutLanguages().Show();
        }

        private TreeNode loadAgain(string path, TreeNode node)
        {
            foreach (string str in Directory.GetDirectories(path))
            {
                TreeNode node2 = new TreeNode(str);
                this.loadAgain(str, node2);
                node.Nodes.Add(node2);
            }
            return node;
        }

        private void loadItems(string directory)
        {
            TreeNode node = new TreeNode(directory);
            foreach (string str in Directory.GetDirectories(directory))
            {
                TreeNode node2 = new TreeNode(str);
                node2 = this.loadAgain(str, node2);
                Log.Debug("treeview loaded directory {0}", new object[] { str });
                node.Nodes.Add(node2);
            }
        }

        private void loadTagTreeItems(string[] items)
        {
        }

        private void multipleConfirm(object sender, EventArgs e)
        {
            Button button = (Button) sender;
            mVids.choiceControl parent = (mVids.choiceControl) button.Parent;
            mVids.musicVideo state = parent.getVidWithInfo();
            if (state == null)
            {
                MessageBox.Show("No artist selected.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                state.aI.addMatch = true;
                ThreadPool.QueueUserWorkItem(new WaitCallback(this.sendToAdder), state);
                foreach (Control control2 in this.choiceDialog.flowLayoutPanel1.Controls)
                {
                    mVids.choiceControl control3 = (mVids.choiceControl) control2;
                    if ((control3.parsedArtistBox.Text.Trim().ToLower() == parent.parsedArtistBox.Text.Trim().ToLower()) && (control3 != parent))
                    {
                        mVids.musicVideo video2 = control3.getVid();
                        video2.aI = parent.getartistInfo();
                        Log.Debug("Music Video DB - Found duplicate at {0}", new object[] { video2.Path });
                        ThreadPool.QueueUserWorkItem(new WaitCallback(this.sendToAdder), video2);
                        control3.Dispose();
                    }
                }
                Log.Debug("Music Video DB - Confirmed {0} as {1}", new object[] { parent.parsedArtistBox.Text, parent.getVidWithInfo().aI.name });
                parent.Dispose();
            }
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            this.saveSettings();
            if (this.choiceDialog.Visible)
            {
                this.choiceDialog.Close();
            }
            base.OnClosing(e);
        }

        private void parseTest(string path, string mask)
        {
            this.Cursor = Cursors.WaitCursor;
            List<string> list = new List<string>();
            if (Directory.Exists(path))
            {
                Log.Debug("Music Video DB - Examining {0}", new object[] { path });
                this.textBox4.AppendText(DateTime.Now.ToLongTimeString() + ": Loading and parsing files from " + path + Environment.NewLine);
                List<string> list2 = this.ExamineDir(path, false);
                Log.Debug("Music Video DB - Added {0} files to queue", new object[] { list2.Count.ToString() });
                this.textBox4.AppendText(DateTime.Now.ToLongTimeString() + ": Found " + list2.Count.ToString() + " files" + Environment.NewLine);
                foreach (string str in list2)
                {
                    list.Add(str);
                }
            }
            List<mVids.musicVideo> vids = new List<mVids.musicVideo>();
            foreach (string str2 in list)
            {
                mVids.musicVideo vid = new mVids.musicVideo();
                if (str2.Remove(0, str2.LastIndexOf(@"\") + 1).Contains("-"))
                {
                    string[] strArray = str2.Remove(0, str2.LastIndexOf(@"\") + 1).Split("-".ToCharArray());
                    vid.artist = strArray[0].Trim();
                    vid.Label = strArray[1].Trim();
                    if (vid.Label.Contains("."))
                    {
                        vid.Label = vid.Label.Remove(vid.Label.LastIndexOf("."));
                    }
                }
                else
                {
                    vid.Label = str2.Remove(0, str2.LastIndexOf(@"\") + 1);
                }
                vid.Path = str2;
                vid = new mVids.folderParser().parseFolder(vid, this.parseResults.maskBox.Text, path);
                vids.Add(vid);
            }
            this.parseResults.loadItems(vids);
            this.Cursor = Cursors.Default;
        }

        private void refreshMediaInfo(object sender, DoWorkEventArgs e)
        {
            List<string> list = this.db.getFiles();
            foreach (string str in list)
            {
                this.bgw.ReportProgress(0, "Updating mediainfo for " + str);
            }
        }

        private void refreshParse(object sender, EventArgs e)
        {
            Log.Debug("Chose new folder to parse - " + this.parseResults.pathBox.SelectedText, new object[0]);
            this.parseResults.maskBox.Text = this.parseResults.masks[this.parseResults.pathBox.SelectedIndex];
            this.parseTest(this.parseResults.pathBox.SelectedItem.ToString(), this.parseResults.maskBox.Text);
        }

        private void refreshthBtn_click(object sender, EventArgs e)
        {
            int num;
            if (int.TryParse(this.thumbHeight.Text, out num))
            {
                MessageBox.Show("Video Thumbnail height must be an integer.", "Thumbnail Height Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            if ((double.Parse(this.thumbHeight.Text) % 2.0) != 0.0)
            {
                int num2 = int.Parse(this.thumbHeight.Text) + 1;
                num2 = int.Parse(this.thumbHeight.Text) - 1;
                MessageBox.Show("Video Thumbnail height must be divisible by 2.  Change the value to either " + num2.ToString() + " or " + num2.ToString(), "Thumbnail Height Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            else
            {
                this.bgw = new BackgroundWorker();
                this.bgw.DoWork += new DoWorkEventHandler(this.refreshThumbs);
                this.bgw.ProgressChanged += new ProgressChangedEventHandler(this.bgw_ProgressChanged);
                this.bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.bgw_RunWorkerCompleted);
                this.bgw.WorkerReportsProgress = true;
                this.db.bgw = this.bgw;
                this.bgw.RunWorkerAsync();
            }
        }

        private void refreshThumblink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.bgw = new BackgroundWorker();
            this.bgw.DoWork += new DoWorkEventHandler(this.refreshThumbs);
            this.bgw.ProgressChanged += new ProgressChangedEventHandler(this.bgw_ProgressChanged);
            this.bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.bgw_RunWorkerCompleted);
            this.bgw.WorkerReportsProgress = true;
            this.db.bgw = this.bgw;
            this.bgw.RunWorkerAsync();
        }

        private void refreshThumbs(object sender, DoWorkEventArgs e)
        {
            this.refreshThumblink.Enabled = false;
            this.button4.Enabled = false;
            this.bgw.ReportProgress(0, "Checking for and generating missing thumbnails.");
            foreach (string str in this.db.getFiles())
            {
                int num;
                double num2;
                this.bgw.ReportProgress(0, "Determining aspect ratio for " + str.Remove(0, str.LastIndexOf(@"\") + 1));
                this.db.getInfo(str, out num, out num2);
                this.bgw.ReportProgress(0, "Calculated thumbnail size of " + Math.Round((double) (double.Parse(this.thumbHeight.Text) * num2), 0).ToString() + "x" + this.thumbHeight.Text);
                this.getThumb(str, Math.Round((double) (double.Parse(this.thumbHeight.Text) * num2), 0));
            }
        }

        private void retryBtn_Click(object sender, EventArgs e)
        {
            Button button = (Button) sender;
            mVids.choiceControl parent = (mVids.choiceControl) button.Parent;
            mVids.lastFM tfm = new mVids.lastFM();
            mVids.artistInfo info = tfm.findArtist(parent.getCustomStr(), this.db.getArtists());
            if ((info == null) && (tfm.getLastfmMatches() != null))
            {
                List<mVids.artistInfo> list = tfm.getLastfmMatches();
                mVids.imgthreadJob userState = new mVids.imgthreadJob {
                    type = mVids.imgthreadJob.jobType.multipleChoice,
                    musicVideo = parent.getVid(),
                    artist = parent.getCustomStr(),
                    choices = list
                };
                this.bgw.ReportProgress(50, userState);
            }
            else if (info != null)
            {
                mVids.musicVideo state = parent.getVid();
                state.aI = info;
                state.aI.addMatch = true;
                ThreadPool.QueueUserWorkItem(new WaitCallback(this.sendToAdder), state);
                foreach (Control control2 in this.choiceDialog.flowLayoutPanel1.Controls)
                {
                    mVids.choiceControl control3 = (mVids.choiceControl) control2;
                    if ((control3.parsedArtistBox.Text == parent.parsedArtistBox.Text) && (control3 != parent))
                    {
                        mVids.musicVideo video2 = control3.getVid();
                        video2.aI = info;
                        Log.Debug("Music Video DB - Found duplicate at {0}", new object[] { video2.Path });
                        ThreadPool.QueueUserWorkItem(new WaitCallback(this.sendToAdder), video2);
                        control3.Dispose();
                    }
                }
            }
            parent.Dispose();
        }

        private void saveSettings()
        {
            Settings settings = new Settings(Config.GetFolder(Config.Dir.Config) + "/MediaPortal.xml", true);
            StringBuilder builder = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            for (int i = 0; i < this.listView1.Items.Count; i++)
            {
                string text = this.listView1.Items[i].SubItems[0].Text;
                if (Directory.Exists(text))
                {
                    builder.Append(text + "|");
                }
                builder2.Append(this.listView1.Items[i].SubItems[1].Text + "|");
            }
            settings.SetValue("mvid", "bioLanguage", this.langBox.Text);
            settings.SetValue("mvid", "basepath", builder.ToString());
            settings.SetValue("mvid", "masks", builder2.ToString());
            settings.SetValue("mvid", "ffmpeg", this.textBox1.Text);
            settings.SetValue("mvid", "thumbtime", this.textBox3.Text);
            settings.SetValue("mvid", "thumbheight", this.thumbHeight.Text);
            settings.SetValue("mvid", "lastView", "artist");
            settings.SetValue("mvid", "displayedname", this.textBox5.Text);
            settings.SetValue("mvid", "mosaicsizewidth", this.textBox6.Text);
            settings.SetValue("mvid", "mosaicsizeheight", this.textBox7.Text);
            settings.SetValueAsBool("mvid", "autoqueueall", this.checkBox1.Checked);
            settings.SetValueAsBool("mvid", "toplevelfanart", this.topLevelFanart.Checked);
            settings.SetValueAsBool("mvid", "top100keyfanart", this.top100KeyFanart.Checked);
            settings.SetValueAsBool("mvid", "cycleviews", this.viewDlgChk.Checked);
            if (this.comboBox1.SelectedItem == null)
            {
                this.comboBox1.SelectedIndex = 0;
            }
            settings.SetValue("mvid", "displayedbio", this.comboBox1.SelectedItem.ToString());
            settings.SetValueAsBool("mvid", "grablfmtags", this.checkBox2.Checked);
            settings.SetValue("mvid", "maxtagstograb", this.textBox8.Text);
            settings.SetValueAsBool("mvid", "graballtags", this.checkBox3.Checked);
            settings.Dispose();
        }

        private void scanningListbox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.scanningListbox.SelectedItem.ToString() == "View Parsing Results")
            {
                this.splitContainer1.Panel2.Controls.Clear();
                this.parseResults.Dock = DockStyle.Fill;
                this.splitContainer1.Panel2.Controls.Add(this.parseResults);
            }
        }

        private void sendToAdder(object video)
        {
            mVids.musicVideo video2 = (mVids.musicVideo) video;
            List<mVids.musicVideo> rawVideos = new List<mVids.musicVideo> {
                video2
            };
            if ((video != null) && this.db.Add(rawVideos))
            {
                this.addItems[video2.threadNumber].Set();
            }
        }

        private void setupChoices(List<mVids.artistInfo> choices, mVids.musicVideo vid, string artist)
        {
            if (!(!this.choiceDialog.IsDisposed && this.choiceDialog.Visible))
            {
                this.choiceDialog = new mVids.multipleThreadedChoice();
                this.choiceDialog.Show();
            }
            mVids.choiceControl control = new mVids.choiceControl(choices, vid, artist);
            control.okbtn.Click += new EventHandler(this.multipleConfirm);
            control.skipbtn.Click += new EventHandler(this.skipbtn_Click);
            control.retryBtn.Click += new EventHandler(this.retryBtn_Click);
            this.choiceDialog.flowLayoutPanel1.Controls.Add(control);
            Log.Debug("added choicectrl to dlg", new object[0]);
        }

        private void skipbtn_Click(object sender, EventArgs e)
        {
            Button button = (Button) sender;
            mVids.choiceControl parent = (mVids.choiceControl) button.Parent;
            this.addItems[parent.getVid().threadNumber].Set();
            Log.Debug("skipped {0}", new object[] { parent.getVid().Path });
            parent.Dispose();
        }

        private void tabPage3_GotFocus(object sender, EventArgs e)
        {
        }

        public void updateDB()
        {
            List<string> list = new List<string>();
            if (!GUIWindowManager.Initalized)
            {
                for (int i = 0; i < this.listView1.Items.Count; i++)
                {
                    if (this.listView1.Items[i].ToString().Length > 2)
                    {
                        Log.Debug("Music Video DB - Examining {0}", new object[] { this.listView1.Items[i].ToString() });
                        this.bgw.ReportProgress(1, "Examining directory  " + this.listView1.Items[i].Text);
                        List<string> list2 = this.ExamineDir(this.listView1.Items[i].Text, true);
                        Log.Debug("Music Video DB - Added {0} files to queue", new object[] { list2.Count.ToString() });
                        this.bgw.ReportProgress(1, "Found " + list2.Count.ToString() + " files");
                        foreach (string str in list2)
                        {
                            list.Add(str);
                        }
                    }
                }
            }
            else
            {
                Settings settings = new Settings(Config.GetFolder(Config.Dir.Config) + "/MediaPortal.xml", true);
                string[] strArray = settings.GetValue("mvid", "basepath").Split("|".ToCharArray());
                settings.Dispose();
                foreach (string str2 in strArray)
                {
                    if (Directory.Exists(str2))
                    {
                        List<string> list3 = this.ExamineDir(str2, false);
                        foreach (string str3 in list3)
                        {
                            Log.Info("Music Video DB - Examine loop found {0}", new object[] { str3 });
                            list.Add(str3);
                        }
                    }
                }
            }
            List<string> list4 = this.db.getFiles();
            if (!GUIWindowManager.Initalized)
            {
                this.bgw.ReportProgress(1, "Found " + list.Count.ToString() + " files total");
            }
            Log.Info("Music Video DB - Found {0} files total", new object[] { list.Count.ToString() });
            List<mVids.musicVideo> rawVideos = new List<mVids.musicVideo>();
            foreach (string str3 in list)
            {
                if (!list4.Contains(str3))
                {
                    try
                    {
                        mVids.musicVideo vid = new mVids.musicVideo();
                        if (str3.Remove(0, str3.LastIndexOf(@"\") + 1).Contains("-"))
                        {
                            string[] strArray2 = str3.Remove(0, str3.LastIndexOf(@"\") + 1).Split("-".ToCharArray());
                            vid.artist = strArray2[0].Trim();
                            vid.Label = strArray2[1].Trim();
                            vid.Path = str3;
                        }
                        else
                        {
                            vid.Label = str3.Remove(0, str3.LastIndexOf(@"\") + 1);
                            vid.Path = str3;
                        }
                        foreach (ListViewItem item in this.listView1.Items)
                        {
                            if (vid.Path.StartsWith(item.Text))
                            {
                                vid = new mVids.folderParser().parseFolder(vid, item.SubItems[1].Text, item.Text);
                            }
                        }
                        rawVideos.Add(vid);
                        if (!GUIWindowManager.Initalized)
                        {
                            this.bgw.ReportProgress(1, str3 + " added to update queue.");
                        }
                        Log.Info("Music Video DB - updateDB found {0}", new object[] { str3 });
                    }
                    catch (Exception exception)
                    {
                        if (!GUIWindowManager.Initalized)
                        {
                            this.bgw.ReportProgress(1, "updateDB encountered an error with file " + str3);
                        }
                        Log.Error("Music Video DB - updateDB encountered an error with file {0} error={1}", new object[] { str3, exception.ToString() });
                    }
                }
            }
            if (rawVideos.Count > 0)
            {
                if (GUIWindowManager.Initalized)
                {
                    this.db.Add(rawVideos);
                }
                else
                {
                    this.addFilesDispatcher(rawVideos);
                }
                if (!(GUIWindowManager.Initalized || !this.bgw.CancellationPending))
                {
                    if (!GUIWindowManager.Initalized)
                    {
                        this.bgw.ReportProgress(1, "Cancelling scan");
                    }
                }
                else
                {
                    if (!GUIWindowManager.Initalized)
                    {
                        this.bgw.ReportProgress(1, "Done updating database");
                        this.bgw.ReportProgress(1, "There are currently " + this.db.getFiles().Count.ToString() + " videos and " + this.db.getArtists().Count.ToString() + " artists in your database");
                    }
                    Log.Info("Music Video DB - Done updating the database", new object[0]);
                }
            }
        }
    }
}

